package com.testapp.servlet;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.testapp.Utils;

@SuppressWarnings("serial")
public class GlobalServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		resp.setContentType("text/plain");
		
		String lhs = req.getParameter("lhs");//if this parameter is present then the request is to calculate the lhs
		
		StringBuffer sb = new StringBuffer();
		
		if(lhs != null) {
			sb.append(Utils.calculateLHS(lhs));
		}
		
		resp.getWriter().println(sb.toString());
	}
}
